<template>
  <div>
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="demo-ruleForm" size="mini">


      <el-form-item label="卡类名称" prop="name">
        <el-input v-model="ruleForm.name" placeholder="请输入卡类名称" clearable></el-input>
      </el-form-item>

      <el-form-item label="卡押金" prop="studentNumber">
        <el-input v-model="ruleForm.studentNumber" placeholder="请输入卡押金" clearable></el-input>
      </el-form-item>

      <el-form-item label="卡年费" prop="IDNmber">
        <el-input v-model="ruleForm.IDNmber" placeholder="请输入卡年费" clearable></el-input>
      </el-form-item>

      <el-form-item label="发卡工本费" prop="IDNmber">
        <el-input v-model="ruleForm.IDNmber" placeholder="请输入发卡工本费" clearable></el-input>
      </el-form-item>

      <!--      下面的不需要验证-->
      <el-form-item label="补卡工本费">
        <el-input v-model="ruleForm.familyPhone" placeholder="请输入补卡工本费" clearable></el-input>
      </el-form-item>

      <el-form-item label="紧急联系人" >
        <el-input v-model="ruleForm.emergencyContact" placeholder="请输入紧急联系人" clearable></el-input>
      </el-form-item>

      <el-form-item label="挂失工本费" >
        <el-input v-model="ruleForm.emergencyContactPhone" placeholder="请输入挂失工本费" clearable></el-input>
      </el-form-item>

      <el-form-item label="消户工本费" >
        <el-input v-model="ruleForm.emergencyContactPhone" placeholder="请输入消户工本费" clearable></el-input>
      </el-form-item>

      <el-form-item label="是否默认" >
        <el-input v-model="ruleForm.emergencyContactPhone" placeholder="请输入保质期" clearable></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="submitForm('ruleForm')">{{$t("action.save")}}</el-button>
        <el-button @click="resetForm('ruleForm')">{{$t("action.reset")}}</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
    export default {
        name: "edit",
        data() {
            return {
                ruleForm: {
                    name: '',//姓名
                    studentNumber: '',//学号
                    IDNmber: '',//身份证号
                    sex: '',//性别
                    ethnic: '',//名族
                    school:'',//学校
                    grade:'',//年级
                    classBan:'',//班级
                    inSchoolDate:'',//入学时间
                    outSchoolDate:'',//毕业时间
                    cardType:'',//卡类型

                    familyPhone:'',//家庭电话
                    emergencyContact:"",//紧急联系人
                    emergencyContactPhone:'',//紧急联系人电话
                    emergencyContactRelation:'',//紧急联系人关系
                    nativePlace:'',//籍贯
                    familyAddress:'',//家庭住址
                    ifInSchool:'',//是否住校
                    status:'',//状态
                },
                rules: {
                    name: [
                        {required: true, message: '请输入姓名', trigger: 'blur'},
                        {min: 2, max: 5, message: '长度在 2 到 5 个字符', trigger: 'blur'}
                    ],
                    studentNumber: [
                        {required: true, message: '请输入学号', trigger: 'blur'},
                        {max: 20, message: '长度不能超过20个字符', trigger: 'blur'}
                    ],
                    IDNmber: [
                        {required: true, message: '请输入身份证号', trigger: 'blur'}
                    ],
                    sex: [
                        {required: true, message: '请选择性别', trigger: 'change'}
                    ],
                    ethnic: [
                        {required: true, message: '请选择名族', trigger: 'change'}
                    ],
                    school: [
                        {required: true, message: '请选择学校', trigger: 'change'}
                    ],
                    grade: [
                        {required: true, message: '请选择年级', trigger: 'change'}
                    ],
                    classBan: [
                        {required: true, message: '请选择班级', trigger: 'change'}
                    ],
                    inSchoolDate: [
                        {required: true, message: '请选择入学时间', trigger: 'change'}
                    ],
                    outSchoolDate: [
                        {required: true, message: '请选择毕业时间', trigger: 'change'}
                    ],
                    cardType: [
                        {required: true, message: '请选择卡类型', trigger: 'change'}
                    ],
                }
            };
        },
        methods: {
            submitForm(formName) {
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        alert('submit!');
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            },
            resetForm(formName) {
                this.$refs[formName].resetFields();
            }
        }

    }
</script>

<style scoped lang="scss">
  .el-select, .el-date-editor {
    width: 100%;
  }

</style>
